package com.zx.erp.repo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zx.erp.repo.bean.Warehouse;
import com.zx.erp.repo.mapper.WarehouseDao;
import com.zx.erp.repo.service.WarehouseBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 仓库Biz接口实现类
 *
 * @author Jerry
 */
@Service
public class WarehouseBizImpl implements WarehouseBiz {
    @Autowired
    private WarehouseDao wareDao;

    @Override
    public PageInfo<Warehouse> findAll(Warehouse ware, Integer pageno, Integer pagesize) {
        PageHelper.startPage(pageno, pagesize);
        List<Warehouse> list = wareDao.findAll(ware);
        PageInfo<Warehouse> pin = new PageInfo<>(list);
        return pin;
    }

    @Override
    public Warehouse findWareById(Integer id) {
        return wareDao.findById(id);
    }

    @Override
    public Boolean updateWare(Warehouse wareById) {
        return wareDao.updateWare(wareById);
    }

    @Override
    public Boolean saveWare(Warehouse wareById) {
        return wareDao.insertWare(wareById);
    }
}
